package com.x4sc.common.network;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by chengshen on 2017/4/4.
 */
public class HttpUtil {

    private HttpUtil() {
        throw new IllegalAccessError("Utility class");
    }

    public final static String getClientIP(HttpServletRequest request) {
        String clientIP = request.getHeader("X-Real-IP");

        if (clientIP != null) {
            return clientIP;
        } else {
            return request.getRemoteAddr();
        }
    }
}
